import 'package:get/get.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:winkai/entity/subscribe_from.dart';
import 'package:winkai/res/app_config.dart';
import 'package:winkai/route/route_manifest.dart';

///跳转工具类
class PageJumpUtils {
  PageJumpUtils._();

  static bool _isToVipPage = false;

  static void toVipPage(SubscribeFrom from) {
    if (!_isToVipPage) {
      _isToVipPage = true;
      Get.toNamed(RouteManifest.vipPage, arguments: from)?.then((value) {
        _isToVipPage = false;
      });
    }
  }

  static void toTermOfUsePage() {
    launchUrl(Uri.parse(AppConfig.termsOfUseUrl));
  }

  static void toPrivacyPolicyPage() {
    launchUrl(Uri.parse(AppConfig.privacyPolicyUrl));
  }

  static void toFeedbackPage() {
    launchUrl(Uri.parse("mailto:${AppConfig.customerServiceEmail}"));
  }
}
